package com.zhuoyue.biz.core.api.dao;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhuoyue.biz.core.api.domain.JointControlRelationDO;

/**
 * @author wjming
 * @ClassName: JointControlRelationDao
 * @Description: 联控关系
 * @Date 2021-07-08 13:50
 */
public interface JointControlRelationDao extends BaseMapper<JointControlRelationDO> {

    /**
     * 删除家庭中所有的联控绑定数据
     *
     * @param homeId
     * @return
     */
    int deleteJointControlRelationByHomeId(String homeId);

    /**
     * 删除设备的联控绑定数据
     *
     * @param deviceId
     * @return
     */
    int deleteJointControlRelationByDeviceId(Long deviceId);

    /**
     * 查询联控设备绑定信息4010专用
     *
     * @param jointObj
     * @return
     */
    List<JointControlRelationDO> selectJointControlRelationListByStartDeviceId4010(
            JointControlRelationDO jointObj);


    /**
     * 查询联控设备绑定信息4011专用
     *
     * @param jointObj
     * @return
     */
    List<JointControlRelationDO> selectJointControlRelationListByStartDeviceId4011(
            JointControlRelationDO jointObj);


    /**
     * 查询联控设备绑定信息4030专用
     *
     * @param jointObj
     * @return
     */
    List<JointControlRelationDO> selectJointControlRelationListByStartDeviceId4030(
            JointControlRelationDO jointObj);

    /**
     * 新增联控设备绑定信息
     *
     * @param relation
     * @return
     */
    int insertJointControlRelation(JointControlRelationDO relation);

    /**
     * 根据主键删除
     *
     * @param id
     * @return
     */
    int deleteJointControlRelationById(String id);


    /**
     * 根据设备mac获得设备联控绑定的集合
     *
     * @param startDeviceMac
     * @param gatewayId
     * @return
     */
    List<JointControlRelationDO> selectRelationCount(String startDeviceMac, String gatewayId);

    /**
     * 删除设备时查询此设备是否还有联控关系
     *
     * @param startDeviceMac 主动联控设备mac
     * @return
     */
    List<JointControlRelationDO> selectStartOrEndRelationCount(String startDeviceMac);

}
